<?php
use LSYS\Area\GEO;
use LSYS\APIServer\ResultFail;
use LSYS\APIServer\ResultSucc;
use LSYS\APIServer\Param;
include_once __DIR__."/Bootstarp.php";
//通过坐标解析地址
$param=Param::factory($_GET);
try{
	$lat=$param->get("lat",NULL,Param::TYPE_STRING_TRIM,true);
	$lng=$param->get("lng",NULL,Param::TYPE_STRING_TRIM,true);
}catch(\LSYS\APIServer\ParamException $e){
	out_json(ResultFail::factory($e->getMESSAGE()));
}
$data=GEO::geo_get_addr($lat,$lng);
list($code,$area,$addr,$detail)=$data;
if (!$code)out_json(ResultFail::factory($detail));
else out_json(ResultSucc::factory($data));